<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <title>{% block title %}Главная{% endblock %}</title>
    <style>
        body {
            margin: 0;
            font-family: Arial, sans-serif;
            padding-top: 50px;
            background-color: #f0f0f0;
        }

        .container {
            padding: 20px;
        }

        .header {
            background-color: #333;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }

        .header a, .logout-link {
            color: white;
            text-decoration: none;
            padding: 10px;
        }

        .header a:hover, .logout-link:hover {
            text-decoration: underline;
        }

        .footer {
            text-align: center;
            margin-top: 40px;
            padding: 20px;
            background-color: #2c3e50;
            color: white;
            position: relative;
            bottom: 0;
            width: 100%;
        }

        .appeal-container {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            margin-top: 20px;
        }

        .appeal {
            background: #fff;
            border: 1px solid #ddd;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            width: calc(33.333% - 20px);
            cursor: pointer;
            text-decoration: none;
            color: inherit;
        }

        .appeal:hover {
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
        }

        .appeal strong {
            display: block;
            margin-bottom: 5px;
        }

        .appeal-detail-container {
            margin: 20px;
            padding: 20px;
            background: #fff;
            border-radius: 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .chat-window {
            border: 1px solid #ddd;
            padding: 10px;
            border-radius: 5px;
            max-height: 300px;
            overflow-y: auto;
            background: #f9f9f9;
            margin-bottom: 20px;
        }

        .chat-message {
            margin-bottom: 10px;
        }

        .user-message {
            background: #e6f7ff;
            padding: 10px;
            border-radius: 5px;
        }

        .support-message {
            background: #d9f7be;
            padding: 10px;
            border-radius: 5px;
        }

        .send-message-container, .promo-container {
            margin-bottom: 20px;
        }

        textarea {
            width: 100%;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
            resize: vertical;
        }

        button {
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            background-color: #007bff;
            color: white;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        button:hover {
            background-color: #0056b3;
        }

        .form-container {
            background: #fff;
            border: 1px solid #ddd;
            border-radius: 10px;
            padding: 20px;
            margin: 20px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .form-container h1 {
            margin-top: 0;
        }

        .form-container form {
            display: flex;
            flex-direction: column;
        }

        .form-container label {
            margin-top: 10px;
        }

        .form-container button {
            margin-top: 20px;
            padding: 10px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        .form-container button:hover {
            background-color: #0056b3;
        }

        .employees-list {
            margin: 20px;
        }

        .employee-item {
            background: #fff;
            border: 1px solid #ddd;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 10px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .employee-item button {
            margin-left: 10px;
            padding: 5px 10px;
            background-color: #dc3545;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        .employee-item button:hover {
            background-color: #c82333;
        }

        .modal {
            display: none;
            position: fixed;
            z-index: 1001;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.4);
        }

        .modal-content {
            background-color: #fff;
            margin: 15% auto;
            padding: 20px;
            border: 1px solid #888;
            width: 80%;
            max-width: 500px;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

        .close {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
        }

        .close:hover, .close:focus {
            color: black;
            text-decoration: none;
            cursor: pointer;
        }

        .search-container {
            margin-bottom: 20px;
        }

        .search-container input {
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 5px;
            width: calc(100% - 42px);
            margin-right: 10px;
        }

        .search-container button {
            padding: 10px 20px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        .search-container button:hover {
            background-color: #0056b3;
        }

        .scooter-container {
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
        }

        .scooter {
            background: #fff;
            border: 1px solid #ddd;
            border-radius: 10px;
            padding: 20px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            width: calc(33.333% - 20px);
            cursor: pointer;
            text-decoration: none;
            color: inherit;
        }

        .scooter:hover {
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
        }

        .modal {
            display: none;
            position: fixed;
            z-index: 1001;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.4);
        }

        .modal-content {
            background-color: #fff;
            margin: 15% auto;
            padding: 20px;
            border: 1px solid #888;
            width: 80%;
            max-width: 500px;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        }

        .close {
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
        }

        .close:hover, .close:focus {
            color: black;
            text-decoration: none;
            cursor: pointer;
        }

        .modal-buttons {
            display: flex;
            justify-content: space-between;
        }

        .modal-buttons button {
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            background-color: #007bff;
            color: white;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .modal-buttons button:hover {
            background-color: #0056b3;
        }

        .modal-buttons button.cancel {
            background-color: #dc3545;
        }

        .modal-buttons button.cancel:hover {
            background-color: #c82333;
        }

        .chat-message {
            margin-bottom: 10px;
            padding: 10px;
            border-radius: 5px;
            width: fit-content;
            max-width: 80%;
        }

        .user-message {
            background: #e6f7ff;
            text-align: right;
            margin-left: auto;
        }

        .support-message {
            background: #d9f7be;
            text-align: left;
            margin-right: auto;
        }
    </style>
</head>
<body>
<!-- Header -->
<div class="header">
    <a href="/">Служба поддержки EcoScooter</a>
    <div>
        {% if (current_user.access_level >= 1 and current_user.access_level <= 2) or current_user.access_level == 0 %}
        <a href="/appeals">Обращения</a>
        {% endif %}
        {% if current_user.access_level == 4 or current_user.access_level == 0 %}
        <a href="/manage_scooters">Ремонт Самокатов</a>
        {% endif %}
        {% if current_user.access_level == 2 or current_user.access_level == 0 %}
        <a href="/statistics">Статистика</a>
        {% endif %}
        {% if current_user.access_level == 4 or current_user.access_level == 0 %}
        <a href="/courier_schedules">Курьеры</a>
        {% endif %}
        {% if current_user.access_level == 0 %}
        <a href="/manage_employees">Администрирование</a>
        {% endif %}
        <a href="#" id="account-link">Личный кабинет</a>
        <a href="/logout" class="logout-link">Выйти</a>
    </div>
</div>
<!-- Main Content -->
<div class="container">
    {% block content %}{% endblock %}
</div>

<!-- Footer -->
<div class="footer">
    &copy; 2024 EcoScooter
</div>
<div id="account-modal" class="modal">
    <div class="modal-content">
        <span class="close">&times;</span>
        <h2>Личный кабинет</h2>
        <p>Имя пользователя: {{ current_user.username }}</p>
    </div>
</div>

<script>
    document.getElementById('account-link').onclick = function () {
        document.getElementById('account-modal').style.display = "block";
    };

    document.getElementsByClassName('close')[0].onclick = function () {
        document.getElementById('account-modal').style.display = "none";
    };

    window.onclick = function (event) {
        if (event.target === document.getElementById('account-modal')) {
            document.getElementById('account-modal').style.display = "none";
        }
    };
</script>
</body>
</html>
